package actions;

//~--- non-JDK imports --------------------------------------------------------

import beans.MergeTopicsFormBean;

import moderator.ModeratorControlPanel;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

//~--- JDK imports ------------------------------------------------------------

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
public class MergeTopics extends org.apache.struts.action.Action {
    public MergeTopics() {}

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                                 HttpServletResponse response)
            throws Exception {
        ActionForward         forward = new ActionForward();
        MergeTopicsFormBean   topics  = (MergeTopicsFormBean) form;
        ModeratorControlPanel modCP   = new ModeratorControlPanel();
        boolean               done    = modCP.merge(topics.getTopicsIds(), topics.getSectionName());

        if (done) {
            forward = mapping.findForward("OperationSuccessful");
        } else {
            forward = mapping.findForward("Operationfailed");
        }

        return forward;
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
